Custant = {};
if (location.href.indexOf("192.168") > -1) {
	Custant.Root = "://192.168.1.228:8080/palmio/";
} else {
	Custant.Root = "://121.199.18.199/";
}
Custant.WebRoot = "http" + Custant.Root;
Custant.ScktRoot = "ws" + Custant.Root;

Vari = {
	ApiRestV1: Custant.WebRoot + "api/1/rest/",
	ApiScktV1: Custant.ScktRoot + "api/1/do.sckt",
	
	CurrFormId: null,
	CurrSessionId: null,
	
	fieldMap: Ember.Map.create(),
	frm: Ember.Object.create(),
	ssn: Ember.Object.create(),
};

Util = {
	isEmpty: function (o){
		if (o == null || o == undefined || o == "") {
			return true;
		} else {
			return false;
		}
	},
	isNotEmpty: function (o){
		return !Util.isEmpty(o);
	},
	capFirstLetter: function (word){
		var w = word.substring(0,1).toUpperCase() + word.substring(1);
		return w;
	},
	lowFirstLetter: function (word){
		var w = word.substring(0,1).toLowerCase() + word.substring(1);
		return w;
	},
	showErrors: function (errorMap, errorList) {		
		var me = this;
		
		$("fieldset.fieldset").removeClass("ferror");
		$("p.errors").remove();
		
		var errors = "";
	     $.each(errorList, function(index, obj) {
	    	 var fieldElm = $(obj.element).parents("fieldset.fieldset");
	    	 var fieldId = fieldElm.attr("id").replace("-fieldset", "");
	    	 var fieldVo =  Vari.fieldMap.get(fieldId);
	    	 errors = obj.message;
	    	 
	    	 fieldElm.addClass("ferror");
	    	 
	    	 var pe = fieldElm.find("p.errors");
	    	 if (pe.length > 0) {
	    		 pe.text(errors);
	    	 } else {
	    		 $("<p class='errors'/>").text(errors).appendTo(fieldElm);
	    	 }
	    });

	}
};